<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ page import="com.scalar.chiptrack.users.User,
                com.scalar.chiptrack.commons.Constants"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/jsp/sales/sales.jsp"/>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.scalar.chiptrack.rma.forms.RMAForm" %>
<%@ page import="com.scalar.chiptrack.users.Functionality" %>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HTML>
<HEAD>
<TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<SCRIPT language="JavaScript">

    var errors = "";
    var dateElement = "";
    function openCalendar(dateValue)
    {
        dateElement = dateValue;
        newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
        newWindow.moveTo(550,180);
        newWindow.focus();
    }

    function assignDate(passedValue)
    {
        dateElement.value=passedValue;
        window.focus();
    }

    function searchRMA(actionForm){
		actionForm.action.value = "Search";
		actionForm.submit();
	}

    function isValidInteger(temp) {
        errors = '';
        if(!isInteger(temp.value)) {
            errors = "Please enter a valid integer";
        }
        var pa=document.getElementById("errors");
        pa.innerHTML = errors;
        return;
    }
   function checkPrice( element,price )
	{
		var partNo = document.rma_list["partNumber"];
		  if(document.rma_list["unitPrice"].length == null) {
			if(price.value != '') {
				var j = 0;
				for(var k = 0; k < (price.value).length;k++) {
					var c = (price.value).charAt(k);
					if( c == '.' ) {
						j++;
						if(j > 1 ) {
							errors = errors +'<br>' + "<li>  Please enter a valid "+element;
							price.select();
							break;
						}
					}
			   }
			   if(check_char_position4(price.value) || (is_Sp_Characters_frieght(price.value) == false)  ) {
					 errors = errors +'<br>' + "<li>  Please enter a valid "+element;
					 price.select();
			   }
			}
			else{
				errors = errors +'<br>' + "<li>  Please enter the "+element;
			}
		  }
		  else
		  {

			for(var i=0; i< price.length; i++)
			{
				if(price[i].value != '')
				{
					if (price[i].value != '')
					{
						var j = 0;
						for(var k = 0; k < (price[i].value).length;k++)
						{
							var c = (price[i].value).charAt(k);
							if( c == '.' )
							{
								j++;
								if(j > 1 )
								{
									errors = errors +'<br>' + "<li>  Please enter a valid "+element;
									price[i].select();
									break;
								}
							}
						}

						if(check_char_position4(price[i].value) || (is_Sp_Characters_frieght(price[i].value) == false) )
						{
							errors = errors +'<br>' + "<li>  Please enter a valid "+element;
							price[i].select();
							break;
						}
					}
					else
					{
						errors = errors +'<br>' + "<li>  Please enter the "+element;
						price[i].select();
						break;
					}
				}
			}
		  }
	}
     function addLineItem() {
        index = document.rma_list.invoiceDate.length;
        if ( index == null )
        {
            index = 1;
        }
        var row = document.all.lineItemsTable.insertRow( lineItemIndex+1 );
        var cell = row.insertCell(0);
        cell.style.width = "8%";
        cell.style.backgroundColor="#DEE1E2";
        var htmlText = '<input type="text" name="lineItemNo"    size="6" class="txfield" value="'+ count +'" disabled="true">';
        cell.innerHTML = htmlText;
        cell = row.insertCell(1);
        cell.style.width = "8%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '<input type="text" name="poLineItemNo" size="6" class="txfield" value="0" maxlength="4" ><input type="hidden" name="lineItemId" value="-1"><input type="hidden" name="lineItemNo" value="'+ count +'" ><input type="hidden" name="isClosed" value="">';
        cell.innerHTML = htmlText;
        cell = row.insertCell(2);
        cell.style.width = "20%";
        cell.style.backgroundColor="#DEE1E2";

        htmlText = '<select name="partNumber" class="txfield" >';
        htmlText = htmlText + '<option value="" >Select Part Number</option>';
        <%
            java.util.ArrayList partsList = null;
            org.apache.struts.util.LabelValueBean option = null;
            StringBuffer strBuffer = null;
            try{
                // Modified by Prabhanjan (14 May 2004) to display Manufacturing Parts instead of Marketing Parts
                //partsList = (java.util.ArrayList)request.getAttribute("mktgParts");
                partsList = (java.util.ArrayList)request.getAttribute("mfgParts");
                if (partsList == null) {
                    partsList = new java.util.ArrayList();
                }

                int partsListSize = partsList.size();
                strBuffer = new StringBuffer();
                for(int cnt = 0 ; cnt < partsListSize; cnt ++ )
                {
             	    option = (org.apache.struts.util.LabelValueBean)partsList.get(cnt);
             	    strBuffer.append("htmlText = htmlText + '");
                    strBuffer.append("<option value=\"").append(option.getLabel()).append("\">");
                    strBuffer.append(option.getLabel()).append("</option>';\n");
                }
                out.println(strBuffer);
            }
            catch(Exception ex)
            {
            	System.out.println(ex);
            }

        %>
        htmlText = htmlText + '</select></td>';
        cell.innerHTML = htmlText;

        cell = row.insertCell(3);
        cell.style.width = "14%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '<input type="text" name="poNumber" size="12" class="txfield" >';
        cell.innerHTML = htmlText;

        cell = row.insertCell(4);
        cell.style.width = "14%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '<input type="text" name="salesOrderNumber" size="12" class="txfield" >';
        cell.innerHTML = htmlText;

        cell = row.insertCell(5);
        cell.style.width = "14%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '<input type="text" name="invoiceNumber" size="12" class="txfield" >';
        cell.innerHTML = htmlText;

        cell = row.insertCell(6);
        cell.style.width = "8%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '<input type="text" name="invoiceDate"   size="12" maxlength="10" class="txfield" >';
        htmlText = htmlText + '&nbsp<a href="javascript:openCalendar(document.rma_list.invoiceDate['+index+'])"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>';
        cell.innerHTML = htmlText;


        cell = row.insertCell(7);
        cell.style.width = "14%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '<input type="text" name="quantity"      size="12" class="valuetxfield" value="0" >';
        cell.innerHTML = htmlText;

        cell = row.insertCell(8);
        cell.style.width = "14%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '<input type="text" name="unitPrice"     size="12" class="valuetxfield" value="0.0" maxlength="9" onkeypress="javascript:restrictCharacters(this,7,3)" onkeyup="javascript:restrictAmt(this,7,3)" >';
        cell.innerHTML = htmlText;

        cell = row.insertCell(9);
        cell.style.width = "8%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '<input type="text" name="extendedPrice"   size="12" class="valuetxfield" value="$0.00" maxlength="9" disabled="true"  onkeypress="javascript:restrictCharacters(this,7,3)" onkeyup="javascript:restrictAmt(this,7,3)">';
        cell.innerHTML = htmlText;

        cell = row.insertCell(10);
        cell.style.width = "14%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '<textarea name="problemDescription" rows="3" cols="20" class="txfield" ></textarea>';
        cell.innerHTML = htmlText;

        cell = row.insertCell(11);
        cell.style.width = "14%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="exchange'+ lineItemIndex +'" value="NO" >&nbsp;&nbsp;&nbsp;&nbsp;';
        cell.innerHTML = htmlText;

        cell = row.insertCell(12);
        cell.style.width = "14%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '&nbsp;&nbsp;&nbsp;<input type="checkbox" name="credit'+ lineItemIndex +'" value="NO" >&nbsp;&nbsp;';
        cell.innerHTML = htmlText;

        cell = row.insertCell(13);
        cell.style.width = "14%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '<input type="checkbox" name="fa'+ lineItemIndex +'" value="NO" >&nbsp;';
        cell.innerHTML = htmlText;

        cell = row.insertCell(14);
        cell.style.width = "14%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '&nbsp;&nbsp;&nbsp;<input type="checkbox" name="cancel'+ lineItemIndex +'" value="NO" disabled="true" >&nbsp;&nbsp;';
        cell.innerHTML = htmlText;

        cell = row.insertCell(15);
        cell.style.width = "14%";
        cell.style.backgroundColor="#DEE1E2";
        htmlText = '<textarea name="remarks"  rows="3" cols="20" class="txfield" ></textarea>';
        htmlText = htmlText +' <input type="hidden" name="closeQty" />';
        htmlText = htmlText +'<input type="hidden" name="receiveQty" />';
        htmlText = htmlText +'<input type="hidden" name="lineItemCloseDate" />';
        cell.innerHTML = htmlText;

        lineItemIndex ++ ;
        count ++ ;
    }
    function submitPage(){
        errors = '';

		if(!dateValidation()) {
            errors = errors;
        }

        var partNo     = document.rma_list["partNumber"];
		var poLineItem = document.rma_list["poLineItemNo"];
		var poNumber   = document.rma_list["poNumber"];
		var qty        = document.rma_list["quantity"];
		var date       = document.rma_list["invoiceDate"];
        var problemDesc=document.rma_list["problemDescription"];
		var remarks    = document.rma_list["remarks"];
        var req_date   = document.rma_list["rmaRequestDate"];
        var issue_date = document.rma_list["rmaIssueDate"];

        //Commented as we removed Close date for RMA
        //var close_date = document.rma_list["closeDate"];
        //var closeDate    = document.rma_list["lineItemCloseDate"];

        //var closeQty    =  document.rma_list["closeQty"];

        var email      = document.rma_list["email"];
		var unit_price      = document.rma_list["unitPrice"];
		//var extended_price = document.rma_list["extendedPrice"];

        //Added by Krishna Prasad on 13 May 2004 , to elimenate the leadin and trail spaces for Quantity,Price
        removePrePostSpaces(poLineItem);
        removePrePostSpaces(qty);
        removePrePostSpaces(document.rma_list["unitPrice"]);

		if( chkDate(req_date.value,"Requested Date","Y") == false) {
			errors = errors +'<br>' + errMsg;
			req_date.select();
			req_date.focus();
		}
	<%-- if( email.value !='' && ValidateMail(email.value) == false) { --%>
        if( email.value !='' && !ValidEMail(email.value) ) {         <%--modified by varma (15jun2004) to restict the mails like xxx@xx...xx --%>
			errors = errors +'<br>' + "<li>"+'Please Enter a Valid Email Address';
			email.select();
			email.focus();
		}
		if( chkDate(issue_date.value,"RMA Issue Date","N") == false) {
			errors = errors +'<br>' + errMsg;
			issue_date.select();
			issue_date.focus();
		}
        if( chkDate(req_date.value,"","Y") && chkDate(issue_date.value,"","N") && req_date.value != '' && issue_date.value != '') {
            if( CompareDate( req_date.value, issue_date.value ) == false ) {
                errors = errors +'<br>' + "<li> RMA Issue date cannot be less than requested date";
                issue_date.select();
                issue_date.focus();
            }
        }
        <!--added by Varma on 04-jun-2004-->
        if(issue_date.value != '' && chkDate(issue_date.value,"Issued Date","N") == true) {
				var dateValue = issue_date.value.split("/");
				if( isDateBefore(dateValue[0],dateValue[1]-1,dateValue[2] ) == true ) {
					errors = errors +'<br>' + "<li> RMA Issue date cannot be greater than todays date";
                     issue_date.select();
                    issue_date.focus();
            }
          }  <!-- till here-->

        /* Commented as we removed Close date for RMA
		if( chkDate(close_date.value,"Close Date","N") == false) {
			errors = errors +'<br>' + errMsg;
			close_date.select();
			close_date.focus();
		}
        */

		if ( req_date.value !='' ) {

            /* Commented as we removed Close date for RMA
            if(chkDate(req_date.value,"","Y") && chkDate(close_date.value,"","N") && req_date.value != '' && close_date.value != '') {
                if( CompareDate( req_date.value, close_date.value ) == false ) {
                    errors = errors +'<br>' + "<li> Closed date cannot be less than requested date";
                    close_date.select();
                    close_date.focus();
                }
            }
            */

			if(issue_date.value == '') {
				errors = errors +'<br>' + "<li> RMA Issue date should be filled ";
				issue_date.select();
				issue_date.focus();
			}

            /* Commented as we removed Close date for RMA
            if(close_date.value != '') {
                if(document.rma_list["quantity"].length == null) {
                    if ( isEmptyTextArea(trim(remarks.value)) == true ) {
                            remarks.value = "";
                        }
                    if(remarks.value == '' ) {
                        errors = errors +'<br>' + "<li> Remarks should not be empty if close date is entered";
                    }
                }
                else {
                    for( var i = 0; i < qty.length; i++ )
                    {
                        if ( isEmptyTextArea(trim(remarks[i].value)) == true ) {
                            remarks[i].value = "";
                        }
                        if(remarks[i].value != '' )  {
                            break;
                        }
                    }
                    for( var j = 0 ; j < qty.length; j++ )
                    {
                       if ( partNo[j].value != ''){
                            break;
                       }
                    }
                    if( i >= qty.length  &&  j < qty.length ) {

                        errors = errors +'<br>' + "<li> Remarks should be added for atleast one line item if close date is entered";
                    }
                }
            } */
        }

		if(document.rma_list["quantity"].length == null) {

			if(partNo.value != '') {
				if(partNo.value == '---- BOARD -----' || partNo.value == '---- KIT -----' || partNo.value == '---- CHIPS -----') {
                    errors = errors +'<br>' + "<li>  Please select  a valid Part Number ";
                }

                if(qty.value != '') {
                    if(!isInteger(qty.value)) {
                        errors = errors +'<br>' + "<li>  Please enter a valid quantity ";
                        qty.select();
						qty.focus();
                    }
                    else if(qty.value == 0) {
                        errors = errors +'<br>' + "<li>  Please enter a valid quantity ";
                        qty.select();
						qty.focus();

                    }
                    else if((qty.value).length > 6) {
                        errors = errors +'<br>' + "<li>  Please enter a valid quantity (should not allow more than 6 digits)";
                        qty.select();
						qty.focus();
                    }
                }
                else {
                    errors = errors +'<br>' + "<li>  Please enter the quantity";
					qty.select();
					qty.focus();
                }
				if(poLineItem.value != ''){
					if(!isInteger(poLineItem.value)) {
                        errors = errors +'<br>' + "<li>  Please enter a valid PO LineItem Number";
                        poLineItem.select();
						poLineItem.focus();
                    }
                    else if(poLineItem.value == 0) {
                        errors = errors +'<br>' + "<li>  PO LineItem Number should not be zero";
                        poLineItem.select();
						poLineItem.focus();
                    }
				}
				else {
                    errors = errors +'<br>' + "<li>  Please enter the PO LineItem Number";
					poLineItem.select();
					poLineItem.focus();
                }

               /* if( closeDate.value != '' )
                {
                    if( chkDate(closeDate.value,"Close Date","N") == false) {
                        errors = errors +'<br>' + errMsg;
                        closeDate.select();
                        closeDate.focus();
                    }
                    else {
                        if(chkDate(req_date.value,"","Y") && chkDate(closeDate.value,"","N") && req_date.value != '' && closeDate.value != '')
                        {
                            if( CompareDate( req_date.value, closeDate.value ) == false )
                            {
                                errors = errors +'<br>' + "<li> Closed date cannot be less than requested date";
                                closeDate.select();
                                closeDate.focus();
                            }
                        }
                            if ( isEmptyTextArea(trim(remarks.value)) == true ) {
                                    remarks.value = "";
                                }
                            if(remarks.value == '' ) {
                                errors = errors +'<br>' + "<li> Remarks should not be empty if close date is entered";
                            }
                            else if ( document.rma_list.cancel0.checked == true ) {
                                errors = errors +'<br>' + "<li> Line Item cannot be closed and cancelled at the same time";
                            }
                            //sujan
                            if(closeQty.value != '')
                            {
                                if(!isInteger(closeQty.value))
                                {
                                    errors = errors +'<br>' + "<li>  Please enter a valid Close quantity ";
                                    closeQty.select();
						            closeQty.focus();
                                }
                                else if(closeQty.value == 0)
                                {
                                    errors = errors +'<br>' + "<li>  Please enter a valid Close quantity ";
                                    closeQty.select();
						            closeQty.focus();
                                }
                                else if( parseInt(closeQty.value)>parseInt(qty.value) )
                                {
                                    errors = errors +'<br>' + "<li> Close quantity can not be greater than " + qty.value;
                                    closeQty.select();
						            closeQty.focus();
                                }
                                else if((closeQty.value).length > 6)
                                {
                                    errors = errors +'<br>' + "<li>  Please enter a valid Close quantity (should not allow more than 6 digits)";
                                    closeQty.select();
						            closeQty.focus();
                                }
                            }
                            else
                            {
                                errors = errors +'<br>' + "<li>  Please enter the Close quantity";
					            closeQty.select();
					            closeQty.focus();
                            }
                            //sujan
                    }
				}*/
				/*if(trim(poNumber.value) =='' ) {
					errors = errors +'<br>' + "<li>  Please enter the Purchase Order Number";
					poNumber.select();
					poNumber.focus();
				}*/
			}
			else {
			        errors = errors +'<br>' + "<li>  Please select  a valid Part Number ";
					partNo.focus();
			}
        }
        else {

            for(var i=0; i< qty.length; i++)
            {

                if(partNo[i].value != '') {
					if(partNo[i].value == '---- BOARD -----' || partNo[i].value == '---- KIT -----' || partNo[i].value == '---- CHIPS -----' )
					{
						errors = errors +'<br>' + "<li>  Please select  a valid Part Number";
                        partNo[i].focus();
						//errors = errors +'<br>' + "<li>  Please select  a valid Part Number for Lineitem"+(i+1);

					}
                    if (qty[i].value != '') {
			            if(!isInteger(qty[i].value)) {
				            errors = errors +'<br>' + "<li>  Please enter a valid quantity ";
				            qty[i].select();
							qty[i].focus();
							break;
			            }
                        else if(qty[i].value == 0) {
				            errors = errors + '<br>' +"<li>  Please enter a valid quantity";
				            qty[i].select();
							qty[i].focus();
							break;
			            }
                        else  if((qty[i].value).length > 6) {
				            errors = errors + '<br>' +"<li>  Please enter a valid quantity (should not allow more than 6 digits)";
				            qty[i].select();
							qty[i].focus();
							break;
         		        }
                    }
                    else {
			            errors = errors +'<br>' + "<li>  Please enter the quantity";
                        qty[i].select();
						qty[i].focus();
						break;
                    }
					if(poLineItem[i].value != ''){
						if(!isInteger(poLineItem[i].value)) {
							errors = errors +'<br>' + "<li>  Please enter a valid PO LineItem Number";
							poLineItem[i].select();
							poLineItem[i].focus();
							break;
						}
						else if(poLineItem[i].value == 0) {
							errors = errors +'<br>' + "<li>  PO LineItem Number should not be zero";
							poLineItem[i].select();
							poLineItem[i].focus();
							break;
						}
					}
					else {
						errors = errors +'<br>' + "<li>  Please enter the PO LineItem Number";
						poLineItem[i].select();
						poLineItem[i].focus();
						break;
					}
					/*if(trim(poNumber[i].value) =='' ) {
						errors = errors +'<br>' + "<li>  Please enter the Purchase Order Number";
						poNumber[i].select();
						poNumber[i].focus();
						break;
					}*/
					<!--  Added by veeru on (05/03/04)  -->
					if( i > 0) {
						if( partNo[i-1].value == '') {
							errors = errors +'<br>' + "<li>  Please select a valid Part Number ";
                            partNo[i-1].focus();
							//errors = errors +'<br>' + "<li>  Please select  a valid Part Number for Lineitem"+(i);
							break;
						}
					}
					<!-- end of Added by veeru on (05/03/04) -->
                    // Close Date Validation
                    var cancel = eval("document.rma_list.cancel"+ i );
                    /*if( closeDate[i].value != '' )
                    {
                        if( chkDate(closeDate[i].value,"Close Date","N") == false) {
                            errors = errors +'<br>' + errMsg;
                            closeDate[i].select();
                            closeDate[i].focus();
                        }
                        else {
                            if(chkDate(req_date.value,"","Y") && chkDate(closeDate[i].value,"","N") && req_date.value != '' && closeDate[i].value != '')
                            {
                                if( CompareDate( req_date.value, closeDate[i].value ) == false )
                                {
                                    errors = errors +'<br>' + "<li> Closed date cannot be less than requested date";
                                    closeDate[i].select();
                                    closeDate[i].focus();
                                    break;
                                }
                                if ( isEmptyTextArea(trim(remarks[i].value)) == true )
                                {
                                       remarks[i].value = "";
                                }
                                if(remarks[i].value == '' ) {
                                     errors = errors +'<br>' + "<li> Remarks should not be empty if close date is entered";
                                     break;
                                }
                                else if ( cancel.checked == true ) {
                                     errors = errors +'<br>' + "<li> Line Item cannot be closed and cancelled at the same time";
                                     break;
                                }
                            //sujan
                             if(closeQty[i].value != '')
                             {
                                if(!isInteger(closeQty[i].value))
                                {
                                    errors = errors +'<br>' + "<li>  Please enter a valid Close quantity ";
                                    closeQty[i].select();
						            closeQty[i].focus();
                                    break;
                                }
                                else if(closeQty[i].value == 0)
                                {
                                    errors = errors +'<br>' + "<li>  Please enter a valid Close quantity ";
                                    closeQty[i].select();
						            closeQty[i].focus();
                                    break;
                                }
                                else if( parseInt(closeQty[i].value)>parseInt(qty[i].value) )
                                {
                                    errors = errors +'<br>' + "<li> Close quantity can not be greater than " + qty[i].value;
                                    closeQty[i].select();
						            closeQty[i].focus();
                                    break;
                                }

                            }
                            else
                            {
                                errors = errors +'<br>' + "<li>  Please enter the Close quantity";
					            closeQty[i].select();
					            closeQty[i].focus();
                                break;
                            }
                            //sujan

                            }
                        }
                    }// End of close Date Validation*/
		        }
                else if( (trim(qty[i].value).length != 1 && trim(qty[i].value) != 0 ) || (trim(date[i].value).length != 0 ) || ( trim(remarks[i].value).length != 0  && isEmptyTextArea(trim(remarks[i].value)) == false ) ) {

					if(partNo[i].value == '') {
			            errors = errors +'<br>' + "<li>  select a valid Part Number" ;
                        partNo[i].focus();
			            //errors = errors +'<br>' + "<li>  select a valid Part Number for line item"+(i+1);
						break;
					}
                }
            }
         }
		checkPrice("price",unit_price);
		//checkPrice("extended price",extended_price);


        //Starts Here Added by Krishna Prasad on 17 May 2004, Text Area Validation
        if(typeof remarks.length == 'undefined' )
        {
            if( remarks.value.length > 400 )
            {
                errors = errors + "<br>" + "<li>  Remarks should not more than 400 Characters ...";
                remarks.focus();
            }
        }
        else
        {
            for( var x=0; x < remarks.length; x++ )
            {
                if( remarks[x].value.length > 400 )
                {
                    errors = errors + "<br>" + "<li>  Remarks should not more than 400 Characters ...";
                    remarks[x].focus();
                    break;
                }
            }
        }

        if(typeof problemDesc.length == 'undefined' )
        {
            if( problemDesc.value.length > 400 )
            {
                errors = errors + "<br>" + "<li>  Problem Description should not more than 400 Characters ...";
                problemDesc.focus();
            }
        }
        else
        {
            for( var x=0; x < problemDesc.length; x++ )
            {
                if( problemDesc[x].value.length > 400 )
                {
                    errors = errors + "<br>" + "<li>  Problem Description should not more than 400 Characters ...";
                    problemDesc[x].focus();
                    break;
                }
            }
        }
        //Ends Here Added by Krishna Prasad on 17 May 2004, Text Area Validation

		if(errors == '') {
			document.rma_list.rmaNumber.disabled = false;
			var partNumbers        = eval(document.rma_list["partNumber"]);
            var poLineItemNo       = eval(document.rma_list["poLineItemNo"]);
            var poNumber           = eval(document.rma_list["poNumber"]);
            var invoiceNumber      = eval(document.rma_list["invoiceNumber"]);
            var invoiceDate        = eval(document.rma_list["invoiceDate"]);
            var quantity           = eval(document.rma_list["quantity"]);
            var unitPrice          = eval(document.rma_list["unitPrice"]);
            var problemDescription = eval(document.rma_list["problemDescription"]);
            var remarks            = eval(document.rma_list["remarks"]);
            var closeDate          = eval(document.rma_list["lineItemCloseDate"]);
            var receiveQty           = eval(document.rma_list["receiveQty"]);

            if(partNumbers.name == 'partNumber') {
				document.rma_list.partNumber.disabled = false;
                document.rma_list.poLineItemNo.disabled = false;
                document.rma_list.poNumber.disabled = false;
                document.rma_list.invoiceNumber.disabled = false;
                document.rma_list.invoiceDate.disabled = false;
                document.rma_list.quantity.disabled = false;
                document.rma_list.unitPrice.disabled = false;
                document.rma_list.problemDescription.disabled = false;
                document.rma_list.remarks.disabled = false;

                document.rma_list.exchange0.disabled = false;
                document.rma_list.credit0.disabled = false;
                document.rma_list.fa0.disabled = false;
                document.rma_list.cancel0.disabled = false;

                //document.rma_list.closeQty.disabled = false;

                document.rma_list.lineItemCloseDate.disabled = false;
			} else {
				for(var i=0; i< partNumbers.length; i++)
				{
					partNumbers[i].disabled = false;
                    poLineItemNo[i].disabled = false;
                    poNumber[i].disabled = false;
                    invoiceNumber[i].disabled = false;
                    invoiceDate[i].disabled = false;
                    quantity[i].disabled = false;
                    unitPrice[i].disabled = false;
                    problemDescription[i].disabled = false;
                    remarks[i].disabled = false;
                    var exchange = eval("document.rma_list.exchange"+i  );
                    exchange.disabled = false;
                    var credit = eval("document.rma_list.credit"+i );
                    credit.disabled = false;
                    var fa = eval("document.rma_list.fa"+i );
                    fa.disabled = false;
                    var cancel = eval("document.rma_list.cancel"+i );
                    cancel.disabled = false;

                    //closeQty[i].disabled = false;

                    //closeDate[i].disabled   = false;
				}
			}

            document.rma_list.address1.disabled = false;
            document.rma_list.address2.disabled = false;
            document.rma_list.address3.disabled = false;
            document.rma_list.address4.disabled = false;
            document.rma_list.city.disabled = false;
            document.rma_list.state.disabled = false;
            document.rma_list.zipcode.disabled = false;
            document.rma_list.country.disabled = false;
             document.rma_list.vendorAddressString.disabled = false;
			//document.rma_list.action.value ="SaveForm";
            document.rma_list.action.value ="IssueForm";
			document.rma_list.submit();
		}
		else {
			var pa = document.getElementById("errors");
			pa.innerHTML = errors;
		}
    }
   	function dateValidation() {
	    var temp = document.rma_list["invoiceDate"];
        if ( temp.length == null ) {
			if( chkDate(temp.value,"Invoice Date","N") == false) {
				errors = errMsg;
				temp.select();
				temp.focus();
			}
			
			if(temp.value != '' && chkDate(temp.value,"Invoice Date","N") == true) {
				var dateValue = temp.value.split("/");
				if( isDateBefore(dateValue[0],dateValue[1]-1,dateValue[2] ) == true ) {
					errors = errors +'<br>' + "<li> Invoice date should not be greater than todays date"
					temp.select();
					temp.focus();
				}
			}
        }
		else {
			var partNo = document.rma_list["partNumber"];
			for( var i=0; i< temp.length; i++)
			{
				if(partNo[i].value != '') {
					if( chkDate(temp[i].value,"Invoice Date ","N") == false) {
						errors = errMsg;
						temp[i].select();
						temp[i].focus();
						break;
					}
					<!-- Added by veeru on (03/05/04) -->
					if(temp[i].value != '' && chkDate(temp[i].value,"Invoice Date","N") == true) {
						var dateValue = temp[i].value.split("/");
						if( isDateBefore(dateValue[0],dateValue[1]-1,dateValue[2] ) == true ) {
							errors = errors +'<br>' + "<li> Invoice date should not be greater than todays date"
							temp[i].select();
							temp[i].focus();
                            break;
						}
					}
				}
			}
		}
		if(errors != '') {
			return false;
		}
        else {
            return true;
		}
    }
   <%-- function submitPage(){
		errors = '';
		if( trim(document.rma_list["rmaNumber"].value) =='' ) {
			errors = "<li>  Please Enter RMA Number";
			document.rma_list["rmaNumber"].focus();
		}
		var temp = document.rma_list["rmaRequestDate"];
		if( chkDate(temp.value,"Requested Date","Y") == false) {
			errors = errors +'<br>' + errMsg;
			temp.select();
			temp.focus();
		}
		temp = document.rma_list["email"];
		if( temp.value !='' && !ValidEMail(temp.value) ) {     --%><%--to restict the mails like xxx@xx...xx --%><%--
            errors = errors +'<br>' + "<li>"+'Please Enter a Valid Email Address';
			temp.select();
			temp.focus();
		}
		temp = document.rma_list["rmaIssueDate"];
		if( chkDate(temp.value,"Rma Issue Date","N") == false) {
			errors = errors +'<br>' + errMsg;
			temp.select();
			temp.focus();
		}
        if( chkDate(document.rma_list["rmaRequestDate"].value,"","Y") && chkDate(temp.value,"","N") && document.rma_list["rmaRequestDate"].value != '' && temp.value != '') {
            if( CompareDate( document.rma_list["rmaRequestDate"].value, document.rma_list["rmaIssueDate"].value ) == false ) {
            errors = errors +'<br>' + "<li> RMA Issue date cannot be less than requested date";
            temp.select();
            temp.focus();
            }
		}
        <!--to validate Issued Date-->
        if(document.rma_list["rmaIssueDate"].value != '' && chkDate(document.rma_list["rmaIssueDate"].value,"Issued Date","N") == true) {
				var dateValue = document.rma_list["rmaIssueDate"].value.split("/");
				if( isDateBefore(dateValue[0],dateValue[1]-1,dateValue[2] ) == true ) {
					errors = errors +'<br>' + "<li> RMA Issue date cannot be greater than todays date";
                    temp.select();
                    temp.focus();
            }
          }
		if(errors == '') {
            document.rma_list.address1.disabled = false;
            document.rma_list.address2.disabled = false;
            document.rma_list.address3.disabled = false;
            document.rma_list.address4.disabled = false;
            document.rma_list.city.disabled = false;
            document.rma_list.state.disabled = false;
            document.rma_list.zipcode.disabled = false;
            document.rma_list.country.disabled = false;
            document.rma_list.vendorAddressString.disabled = false;            
            document.rma_list.action.value ="IssueForm";
		 	document.rma_list.submit();
		}
		else {
			var pa = document.getElementById("errors");
			pa.innerHTML = errors+'<p>';
		}
	}--%>
    function selectvendorAddress ()
   {
    for( ff = 0; ff < vendorIdAddress.length; ff++ )
    {
       if( document.rma_list.vendorId.value == vendorIdAddress[ff] )
       {
            document.rma_list.vendorId.value = vendorIdAddress[ff];
            document.rma_list.vendorAddressString.value = vendorAddress[ff].replace(/~/g,'\n');
       }
    }
}



<%
    RMAForm rmaForm = null;
    rmaForm = (RMAForm) request.getAttribute("generateRmaForm");
    HashMap vendorAddressList = rmaForm.getVendorAddressMap();
    if (vendorAddressList != null) {

        int vendorListSize = vendorAddressList.size();
        java.util.Iterator vendorIterator = vendorAddressList.keySet().iterator();
        String vendorAddresses[] = new String[vendorListSize];
%>
            var vendorIdAddress = new Array(<%=vendorListSize%>);
            var vendorAddress       = new Array(<%=vendorListSize%>);
            vendorIdAddress[-3] = '';
            vendorIdAddress[-2] = -1;
            vendorIdAddress[-1] = '';
        <%
        for( int bb = 0; bb < vendorListSize ; bb++)
        {
           Object key = (String)vendorIterator.next();
           if( vendorAddressList.get(key)!= null )
            {
                if(vendorAddressList.containsKey(key))
                {
                    vendorAddresses[bb] = (String)vendorAddressList.get(key);
                    %>
                        vendorIdAddress[<%=bb%>] = '<%=key.toString().replaceAll("'","\\\\" + "'")%>';
                        vendorAddress[<%=bb%>]       = '<%=(vendorAddresses[bb].toString()).replace('\n','~').replaceAll("'","\\\\" + "'")%>';


                    <%
               }
           }
       } //for
   }
%>
</SCRIPT>
</HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
    <TR>
	    <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
            <%@ include file="/jsp/sales/rma_menu.jsp" %>
            <!-- end of the side navigations -->
        </TD>
        <TD bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=50></TD>
        <TD valign="top" width="100%" align=center>
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR>
            <table border="0" width="35%" align=center>
                <tr>
                    <td colspan="5" class="NArialW" align='left'>
                        RMA Form
                    </td>
                </tr>
            </table>
            <!-- from here your body starts -->
            <html:form name="rma_list" method="post" action="/generateRMA.do" scope="request" type="com.scalar.chiptrack.rma.forms.RMAForm" >
            <table border="0" width="80%" align=center>
                <tr>
                    <td colspan="5" class="NArialL"><chiptrack:errors styleClass="NArialL" />&nbsp;<a name="#e1"></a></td>
                </tr>
                <logic:equal name="showMessage" value="TRUE">
                <tr>
                    <td colspan="5" align='left'>
                        <font class='NArialS'><font color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b></font></font>&nbsp;
                    </td>
                </tr>
                </logic:equal>
                <tr>
                    <td colspan="5" align="left" class='NArialL'><FONT id="errors" styleClass="NArialL" color='FF0000'></FONT>&nbsp;</td>
                </tr>
                <tr><td colspan="5" >&nbsp;</td></tr>
                <tr>
                    <td width="10%"><font class="NArialL">RMA Number :&nbsp;<font color=red>*</font></font></td>
                    <td width="15%">
                    <html:text name="generateRmaForm" property="rmaNumber" styleClass="txfield" size="23" maxlength="50" />
                    </td>
                    <td width="20%">&nbsp;</td>
                    <td width="10%"><font class="NArialL">Customer Name :</font></td>
                    <td class="bodytext">
                        <b><bean:write name="generateRmaForm" property="customerName" /></b>
                        <html:hidden name="generateRmaForm" property="customerName" />
                        <html:hidden name="generateRmaForm" property="customerId" />
                    </td>
                    <%--<td width="3%">&nbsp;</td>--%>
                </tr>
                <tr>
                    <td><font class="NArialL">Requested Date :&nbsp;<font color=red>*</font></font></td>
                    <td>
                    <html:text name="generateRmaForm" property="rmaRequestDate" styleClass="txfield" size="23" maxlength="10" onkeyup=""/>
                    <a href="javascript:openCalendar(document.rma_list.rmaRequestDate)"><img onMouseOver="window.status='Click here to select date';return true"onMouseOut="window.status='';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                    </td>
                    <td>&nbsp;</td>
                    <td><font class="NArialL">Contact Person :</font></td>
                    <td>
                    <html:text name="generateRmaForm" property="contactPerson"  size="23" styleClass="txfield" />
                    </td>
                    <%--<td>&nbsp;</td>--%>
                </tr>
                <tr>
                    <td><font class="NArialL">Phone :</font></td>
                    <td>
                    <html:text name="generateRmaForm" property="phoneNumber" size="23" styleClass="txfield" onkeypress='validatePhoneNumber(this)'/>
                    </td>
                    <td>&nbsp;</td>
                    <td><font class="NArialL">Fax :</font></td>
                    <td>
                    <html:text name="generateRmaForm" property="faxNumber" size="23" styleClass="txfield" onkeypress='validatePhoneNumber(this)'/>
                    </td>
                    <%--<td>&nbsp;</td>--%>
                </tr>
                <tr>
                    <td><font class="NArialL">Email :</font></td>
                    <td>
                    <html:text name="generateRmaForm" property="email" size="23" styleClass="txfield" disabled="false"/>
                    </td>
                    <td>&nbsp;</td>
                    <td><font class="NArialL">RMA Issue date :</font></td>
                    <td nowrap>
                    <html:text name="generateRmaForm" property="rmaIssueDate" size="23"  maxlength="10" styleClass="txfield" />
                    <a href="javascript:openCalendar(document.rma_list.rmaIssueDate)"><img onMouseOver="window.status='Click here to select date';return true"onMouseOut="window.status='';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                    </td>
                    <%--<td>&nbsp;</td>--%>
                </tr>
                <tr>
                    <td><font class="NArialL"><bean:message key="label.sales.endCustomer"/> :</font></td>
                    <td>
                   <html:select name="generateRmaForm" property="endUserID" styleClass="txfield" >
                       <html:option value="-1" >----- Select -----</html:option>
                       <html:options collection="endUserList" property="value" labelProperty="label"/>
                   </html:select>
                    </td>
                    <td>&nbsp;</td>
                    <td><font class="NArialL">Ship To :</font></td>
                    <td nowrap>
                           <html:select name="generateRmaForm" property="vendorId" styleClass="txfield"  onchange="selectvendorAddress()">
                       <html:option value="-1" >----- Select -----</html:option>
                       <html:options collection="vendorDetails" property="value" labelProperty="label"/>
                   </html:select>
                    </td>
                    <%--<td>&nbsp;</td>--%>
                </tr>
                <tr><td colspan="5" >&nbsp;</td></tr>
                <tr>
                    <td valign="top" nowrap class="NArialL">From (Billing Address) :</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td valign="top" nowrap class="NArialL">Vendor Address :</td>
                    <td>&nbsp;</td>
                    <%--<td>&nbsp;</td>--%>
                </tr>
                <tr>
                    <td colspan="5">
                        <table border="0" width="100%">
                            <tr>
                                <td width="5%">&nbsp;</td>
                                <td width="30%">
                                    <table border="0">
                                        <tr>
                                            <td nowrap><font class="NArialL">Address 1 <html:hidden name="generateRmaForm" property="billingAddressId" /></font></td>
                                            <td>&nbsp;&nbsp;<html:text name="generateRmaForm" property="address1" size="23" styleClass="txfield" disabled="true"/></td>
                                        </tr>
                                        <tr>
                                            <td nowrap><font class="NArialL">Address 2 </font></td>
                                            <td>&nbsp;&nbsp;<html:text name="generateRmaForm" property="address2" size="23" styleClass="txfield" disabled="true"/></td>
                                        </tr>
                                        <tr>
                                            <td nowrap><font class="NArialL">Address 3 </font></td>
                                            <td>&nbsp;&nbsp;<html:text name="generateRmaForm" property="address3" size="23" styleClass="txfield" disabled="true"/></td>
                                        </tr>
                                        <tr>
                                            <td nowrap><font class="NArialL">Address 4 </font></td>
                                            <td>&nbsp;&nbsp;<html:text name="generateRmaForm" property="address4" size="23" styleClass="txfield" disabled="true"/></td>
                                        </tr>
                                        <tr>
                                            <td><font class="NArialL">City </font></td>
                                            <td>&nbsp;&nbsp;<html:text name="generateRmaForm" property="city" size="23" styleClass="txfield" disabled="true"/></td>
                                        </tr>
                                        <tr>
                                            <td><font class="NArialL">State </font></td>
                                            <td>&nbsp;&nbsp;<html:text name="generateRmaForm" property="state" size="23" styleClass="txfield" disabled="true"/></td>
                                        </tr>
                                        <tr>
                                            <td><font class="NArialL">Zip </font></td>
                                            <td>&nbsp;&nbsp;<html:text name="generateRmaForm" property="zipcode" size="23" styleClass="txfield" disabled="true"/></td>
                                        </tr>
                                        <tr>
                                            <td><font class="NArialL">Country</font></td>
                                            <td>&nbsp;&nbsp;<html:text name="generateRmaForm" property="country" size="23" styleClass="txfield" disabled="true"/></td>
                                        </tr>
                                    </table>
                                </td>
                                <td width="20%">&nbsp;</td>
                                <td width="45%" valign="top"><html:textarea rows="15" name="generateRmaForm" property="vendorAddressString" cols="30" styleClass="txfield" disabled="true"/></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr><td colspan="5"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                <tr>
                <td colspan="5">
                    &nbsp;
                    <table border="0" width="98%" bordercolor="#FFFFFF" id="lineItemsTable">
                        <tr>
                            <td width="8%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Line Item</font></font>
                            </td>
                            <td width="8%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">PO Line Item#</font></font>
                            </td>
                            <td width="20%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><bean:message key="label.mfgPartNumber" /></font></font>
                            </td>
                            <td width="14%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">PO#</font></font></td>
                            <td width="14%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">SalesOrder #</font></font></td>
                            <td width="14%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Invoice #&nbsp;</font></font></td>
                            <td width="14%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Invoice Date<br><font size="-3">(mm/dd/yyyy)</font></font></font></td>
                            <td width="14%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">&nbsp;Quantity&nbsp;</font></font></td>
                            <td width="14%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">&nbsp;Price&nbsp;</font></font></td>
                            <td width="14%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">&nbsp;Extended Price&nbsp;</font></font></td>
                            <td width="50%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Problem Description&nbsp;</font></font></td>
                            <td width="50%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">&nbsp;Exchange&nbsp;</font></font></td>
                            <td width="50%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">&nbsp;Credit&nbsp;</font></font></td>
                            <td width="50%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">&nbsp;FA&nbsp;</font></font></td>
                            <td width="50%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">&nbsp;Cancel&nbsp;</font></font></td>
                            <td width="50%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Remarks&nbsp;</font></font></td>
                        </tr>
                        <% int index = 0 ; %>
                        <logic:iterate id="LineItem" name="lineItems" type="com.scalar.chiptrack.rma.RMALineItem">
                        <tr>
                            <td width="8%" bgcolor="#DEE1E2">
                               <html:text name="LineItem" property="lineItemNo" size='6' styleClass="txfield" disabled="true"/>
                               <html:hidden name="LineItem" property="lineItemId" />
                               <html:hidden name="LineItem" property="lineItemNo" />
                               <html:hidden name="LineItem" property="isClosed" />
                               <input type="hidden" name="jsLineItemNo" value="<%=LineItem.getLineItemNo()%>">
                            </td>
                            <logic:notEqual name="LineItem" property="status" value="CLOSE">
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <html:text name="LineItem" property="poLineItemNo" size="6" styleClass="txfield" maxlength="4" />
                            </td>
                            <td width="20%" align="center" bgcolor="#DEE1E2">
                                <logic:equal name="LineItem" property="lineItemId" value="-1">
                                <html:select name="LineItem" property="partNumber" styleClass="txfield">
                                    <html:option value="">Select Part Number</html:option>
                                    <html:options collection="mfgParts" property="value" labelProperty="label"/>
                                </html:select>
                                </logic:equal>
                                <logic:notEqual name="LineItem" property="lineItemId" value="-1">
                                    <html:text name="LineItem" property="partNumber" size="25" styleClass="txfield" disabled="true" />
                                </logic:notEqual>
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <html:text name="LineItem" property="poNumber" size="12" styleClass="txfield" />
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <html:text name="LineItem" property="salesOrderNumber" size="12" styleClass="txfield" />
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <html:text name="LineItem" property="invoiceNumber" size="12" styleClass="txfield" />
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2" nowrap>
                                <html:text name="LineItem" property="invoiceDate" size="12" maxlength="10" styleClass="txfield" />
                                <a href="javascript:if(document.rma_list.invoiceDate.length!=null){openCalendar(document.rma_list.invoiceDate[<%=index%>])}else{openCalendar(document.rma_list.invoiceDate)}"><img onMouseOver="window.status='Click here to select date';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <html:text name="LineItem" property="quantity" size="12" styleClass="valuetxfield" />
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <html:text name="LineItem" property="unitPrice" size="12" styleClass="valuetxfield" maxlength="9" onkeypress="javascript:restrictCharacters(this,7,3)" onkeyup="javascript:restrictAmt(this,7,3)" />
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <html:text name="LineItem" property="extendedPriceAsString" size="12" styleClass="valuetxfield" disabled="true" />
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <html:textarea name="LineItem" property="problemDescription" rows="3" cols="20" styleClass="txfield" />
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <logic:equal name="LineItem" property="isExchange" value="true" >
                                    <input type="checkbox" name="exchange<%=index%>" value="NO" CHECKED >
                                </logic:equal>
                                <logic:equal name="LineItem" property="isExchange" value="false" >
                                    <input type="checkbox" name="exchange<%=index%>" value="NO" >
                                </logic:equal>
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <logic:equal name="LineItem" property="isCredit" value="true" >
                                    <input type="checkbox" name="credit<%=index%>" value="NO" CHECKED >
                                </logic:equal>
                                <logic:equal name="LineItem" property="isCredit" value="false" >
                                    <input type="checkbox" name="credit<%=index%>" value="NO" >
                                </logic:equal>
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <logic:equal name="LineItem" property="isFa" value="true" >
                                    <input type="checkbox" name="fa<%=index%>" value="NO" CHECKED >
                                </logic:equal>
                                <logic:equal name="LineItem" property="isFa" value="false" >
                                <input type="checkbox" name="fa<%=index%>" value="NO" >
                                </logic:equal>
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <logic:equal name="LineItem" property="lineItemId" value="-1">
                                    <input type="checkbox" name="cancel<%=index%>" value="NO" disabled="true" >
                                </logic:equal>
                                <logic:notEqual name="LineItem" property="lineItemId" value="-1">
                                <logic:equal name="LineItem" property="isCancel" value="true" >
                                    <input type="checkbox" name="cancel<%=index%>" value="NO" CHECKED >
                                </logic:equal>
                                <logic:equal name="LineItem" property="isCancel" value="false" >
                                    <input type="checkbox" name="cancel<%=index%>" value="NO" >
                                </logic:equal>
                                </logic:notEqual>
                            </td>
                            <td width="14%" align="center" bgcolor="#DEE1E2">
                                <html:textarea name="LineItem" property="remarks" rows="3" cols="20" styleClass="txfield" />
                            </td>
                            <html:hidden name="LineItem" property="closeQty" />
                            <html:hidden name="LineItem" property="receiveQty" />
                            <html:hidden name="LineItem" property="lineItemCloseDate" />
                            </logic:notEqual>
                        </tr>
                        <% index++ ; %>
                        </logic:iterate>
                       <script language="javascript">
                       var lineItemIndex = <%=index%>;
                       var count = <%= (String)request.getAttribute("maxLineItemNo") %>;
                       </script>
                    </table>
                </td>
            </tr>
            <tr><td colspan="5" ><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
            <tr><td colspan="5"><font id="newLineItem"></font></td></tr>
            <tr>
                <td colspan="5">
                    <table width="100%">
                        <tr>
                            <td width="40%"></td><td width="60%" align="center">
                                <a href="javascript:addLineItem();" onmouseover="window.status='Click to Add LineItem';return true" onmouseout="window.status='';return true">
                                    <img src="<%=chipTracContext%>/jsp/includes/images/addmore.gif" border=0 title='Click here to Add Line Item'>
                                </a>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr><td colspan="5" ><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
            <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td align="center">
                    <chiptrack:restrictedLink functionality='<%=Functionality.RMA_FORM%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:submitPage();" onmouseover="window.status='Click here to save RMA Form';return true" onmouseout="window.status='';return true">
                    <img src="<%=chipTracContext%>/jsp/includes/images/save.gif" title="Click here to Save RMA Form"border='0'></chiptrack:restrictedLink>
                </td>
                <td>
                    <a href="javascript:document.rma_list.reset();" onmouseover="window.status='Click here to reset RMA Form';return true" onmouseout="window.status='';return true" title="Click here to Reset">
                    <img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0'>
                    </a>
                </td>
                <td>&nbsp;</td>
                <%--<td width="30%">&nbsp;</td>--%>
            </tr>
        </table>
        <input type="hidden" name="action" value="">
        </html:form>
        <BR><BR><BR>
    </TD>
    <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>



